<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://127.0.0.1/CodeIgniter/assets/development-bundle/ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="http://127.0.0.1/CodeIgniter/assets/development-bundle/ui/jquery.ui.autocomplete.js"></script>

<script>
 $(document).ready(function(){
 
	$(function() {
		$( "#checkIN" ).datepicker({
			showOn: "button",
			buttonImage: "http://127.0.0.1/CodeIgniter/img/ImagePanel/calendar.jpg",
			buttonImageOnly: true
		});
	});
	
	$(function() {
		$( "#checkOUT" ).datepicker({
			showOn: "button",
			buttonImage: "http://127.0.0.1/CodeIgniter/img/ImagePanel/calendar.jpg",
			buttonImageOnly: true
		});
	});
	
	$("#room").click(function () {
			var id = $('#room').val();
		
				if (id == 1)
				{
					$.ajax({
						type: "GET",
						dataType: 'html',
						success: function(data)
						{
						$('#oscar').replaceWith("<table width='100%' border='0' id='oscar'><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'>                        <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>                    </label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option>    </select></label></td></tr></table>");
						}
						});
				}//cierro if == 1
				
				if (id == 2)
				{
					$.ajax({
                    type: "GET",
					dataType: 'html',
					success: function(data)
					{
					$('#oscar').replaceWith("<table width='100%' border='0' id='oscar'><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'>                        <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>                    </label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option>    </select></label></td></tr><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select></label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option></select></label></td></tr></table>");
					}
                	});
					
				}//fin del if==2
				
				if (id == 3)
				{
				$.ajax({
                    type: "GET",
					dataType: 'html',
					success: function(data)
					{
					$('#oscar').replaceWith("<table width='100%' border='0' id='oscar'><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'>                        <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>                    </label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option>    </select></label></td></tr><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select></label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option></select></label></td></tr><tr> <td width='39%'>Adultos <label><select name='select2' id='select2'>                        <option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option></select>                    </label></td> <td width='61%'>Niños <label><select name='select3' id='select3'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option>    </select></label></td></tr></table>");
					}
                	});
				}
     });//fin del function de las habitaciones
	 
	 $("#select3").click(function () {
			var id = $('#select3').val();
			console.log(id);
	      });
		  
		  $("#probando").click(function () {
			var id = $('#probando').val();
                $.ajax(
				{
                    type: "GET",
                    url: "<?php echo base_url().'Travelagencycontroller/ajax_get/'?>" + id,
					dataType: 'html',
					success: function(data)
					{
						var foo = data;
						var bar = foo.split("|");
						$('#plan').replaceWith("<select name='plan' id='plan'>" + bar[1] + "</select>");
						$('#rate').replaceWith("<select name='rate' id='rate'>" + bar[0] + "</select>");
					}
                }
				);
            });//fin de probando 	

});//fin del document ready
	</script>

<style type="text/css">
<!--
.Estilo1 {
	font-family: "Times New Roman", Times, serif;
	font-size: 16px;
	font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="538" border="0" align="right">
        <tr>
          <td><form id="form1" name="form1" method="post" action="<?php echo base_url();?>/Travelagencycontroller/addReservation/<?php echo $id_agency;?>/<?php echo $id_user;?>/<?php echo $username;?>/8">
            <table width="100%" border="0">
              <tr>
                <td colspan="2"><input type="hidden" name="oculto" id="oculto" value="<?php echo $id_agency; ?>" /></td>
              </tr>
              <tr>
                <td colspan="2"><div align="center"></div></td>
              </tr>
              <tr>
                <td><div align="right">Seleccione Hotel Receptor</div></td>
                <td><label>
                  <select name="probando" id="probando">
                    <option value=" "<?php echo set_select('probando','-1',TRUE);?> >Seleccione algún HOTEL</option>
                   <?php
					foreach($hotelsBYagency as $aux)
					{
					?>
                <option value="<?php echo $aux['id_hotel']; ?>"<?php echo set_select('probando',$aux['id_hotel']); ?> > <?php echo $aux['name']; ?></option>
                <?php 
					}	 
					?>
                </select>
                </label></td>
              </tr>
              <tr>
                <td><div align="right">Plan:</div></td>
                <td><select name="plan" id="plan">
       			 <option value=" " <?php echo set_select('plan',' ', TRUE); ?> >Seleccione algún PLAN</option>
    			  </select></td>
              </tr>
              <tr>
                <td><div align="right">Tarifas:</div></td>
                <td><select name="rate" id="rate">
        <option value=" " <?php echo set_select('rate',' ', TRUE); ?> >Seleccione alguna Tarifa</option>
      </select></td>
              </tr>
              <tr>
                <td width="52%"><strong>Características de la Reserva:</strong></td>
                <td width="48%"><div align="right"><strong>Comentario:</strong></div></td>
              </tr>
              <tr>
                <td>Check -- IN : 
                  <input type="text" name="checkIN" id="checkIN"  value="<?php echo set_value('checkIN');?>"/></td>
                <td rowspan="3"><label>
                  <textarea name="comment" id="comment" cols="39" rows="6"><?php echo set_value('comment');?></textarea>
                </label></td>
              </tr>
              <tr>
                <td>Check OUT :
                  <input type="text" name="checkOUT" id="checkOUT"  value="<?php echo set_value('checkOUT');?>"/></td>
              </tr>
              <tr>
                <td>Habitaciones: 
                  <label>
                  <select name="room" id="room">
                    <option value="1">1 Habitación</option>
                    <option value="2">2 Habitaciones</option>
                    <option value="3">3 Habitaciones</option>
                  </select>
                </label></td>
              </tr>
              <tr>
                <td><table width="100%" border="0" id="oscar">
                  <tr>
                    <td width="39%">Adultos 
                      <label>
                      <select name="select2" id="select2">
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                      </select>
                    </label></td>
                    <td width="61%">Niños 
                      <label>
                      <select name="select3" id="select3">
                        <option value="0">0</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                      </select>
                    </label></td>
                  </tr>
                </table></td>
                <td>                  <label>
                  
                <div align="center"></div>
                </label></td>
              </tr>
              <tr>
                <td><strong>Datos del Cliente:</strong></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td colspan="2"><strong>Nombre(s): 
                    <label>                    </label>
                </strong>
                  <label>
                  <input type="text" name="name" id="name" value="<?php echo set_value('name');?>"/>
                  <input type="text" name="name2" id="name2" value="<?php echo set_value('name2');?>"/>
                </label></td>
              </tr>
              <tr>
                <td colspan="2"><strong>Apellido(s):</strong> 
                  <label>
                  <input type="text" name="lastname" id="lastname" value="<?php echo set_value('lastname');?>" />
                  <input type="text" name="lastname2" id="lastname2" value="<?php echo set_value('lastname2');?>"/>
                </label></td>
              </tr>
              <tr>
                <td><div align="right">Cédula de Identidad: 
                  </div>
                <label>
                
                <div align="right">
                  <input type="text" name="ci" id="ci"  value="<?php echo set_value('ci');?>"/>
                </div>
                </label></td>
                <td>
                  <div align="right">
                    <input type="submit" name="button" id="button" value="Enviar Reservación" />
                    </div></td></tr>
              <tr>
                <td colspan="2"><div align="center"><?php echo validation_errors(); ?></div></td>
              </tr>
            </table>
                    <label></label>
          </form>
          </td>
  </tr>
      </table>
<div align="right"></div>
</body>
</html>
